package com.aivin.leakcanarysample.tool;

import android.os.Environment;

import java.io.File;


public class MyFileTool {

    public static String getLeakWatchDir() {
        String localDir = getSdRootDir() + "/a_leakWatch/";
        File file = new File(localDir);
        if (!file.exists()) {
            boolean reslut = file.mkdirs();
            if (!reslut) {
                return null;
            }
        }
        return localDir;
    }

    private static String getSdRootDir() {
        return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) ?
                Environment.getExternalStorageDirectory().getAbsolutePath() :
                Environment.getDataDirectory().getAbsolutePath();
    }

}
